﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace SimpleReminder
{
    public class EventSecondly : EventBase
    {
        public EventSecondly(DataRow dr)
            : base(dr)
        {
            if (base.Type != MyEvents.EventTypes.Secondly)
                throw new MyEvents.InvalidEventTypeException();
        }

        public override bool IsTimeToRun()
        {
            DateTime now = DateTime.Now;
            if (base.CanRun && 
                (now - base.LastRunTime).TotalSeconds >= base.Frequence 
                )
            {
                return true;
            }
            return false;
        }
    }
}
